import Vue from 'vue'
import App from './App'

import store from './store'

Vue.config.productionTip = false

Vue.prototype.$store = store

import service from './service.js'
//挂载
Vue.prototype.service = service;

import md5 from '@/static/js/md5.min.js';
Vue.prototype.$md5 = md5;

import initModal from "@/components/showModal/initModal.js";
import showModal from '@/components/showModal/show-modal';
initModal(Vue);
Vue.component('show-modal',showModal);

import websocket from '@/static/js/websocketStore.js'
Vue.prototype.$websocket = websocket;

Vue.prototype.OnlineAudio = function(){
	var music = null;
	music = uni.createInnerAudioContext(); //创建播放器对象
	music.src= "../../static/music/online.mp3"; //选择播放的音频
	music.play(); //执行播放
}

Vue.prototype.OnlineOutAudio = function(){
	var music = null;
	music = uni.createInnerAudioContext(); //创建播放器对象
	music.src= "../../static/music/onlineout.mp3"; //选择播放的音频
	music.play(); //执行播放
}

Vue.prototype.DingdanAudio = function(){
	var music = null;
	music = uni.createInnerAudioContext(); //创建播放器对象
	music.src= "../../static/music/neworder.mp3"; //选择播放的音频
	music.play(); //执行播放
}

Vue.prototype.OrderingAudio = function(){
	var music = null;
	music = uni.createInnerAudioContext(); //创建播放器对象
	music.src= "../../static/music/ordering.mp3"; //选择播放的音频
	music.play(); //执行播放
}

Vue.prototype.OrdernewAudio = function(){
	var music = null;
	music = uni.createInnerAudioContext(); //创建播放器对象
	music.src= "../../static/music/nnnorder.mp3"; //选择播放的音频
	music.play(); //执行播放
}

Vue.prototype.LineAuto = function(type){
	console.log(type)
	if (type === false) {
		let music = uni.getStorageSync('music');
		if(music === true){	
			this.OnlineOutAudio();
		}
	}else if (type === true) {
		let music = uni.getStorageSync('music');
		if(music === true){
			this.OnlineAudio();
		}
	}
}

App.mpType = 'app'

const app = new Vue({
    store,
    ...App
})
app.$mount()
